import 'dart:math';

import 'package:flutter/material.dart';
import 'package:aio/aio.dart';

import '../../../../generated/app_strings.dart';
import '../../../http/bean/clockin/attendances.dart';
import '../../../http/bean/clockin/clock_in.dart';
import '../../../http/bean/clockin/clockin_point_range.dart';
import '../../../http/bean/clockin/clokin_subdata_type.dart';
import '../../../manager/user_manager.dart';
import '../../../utils/image_path_utils.dart';
import '../../app_ui.dart';
import 'clock_in_record.dart';
import 'clock_in_result.dart';

///打卡记录；在clock_in_record.dart页面里被调用。
class ClockInUi {
  ///打卡记录(打卡结果页面里调用)
  static Widget clockInRecord(BuildContext context, ClockinInfo? WorkInfo) {
    List<Widget> _columnWidgets = [];
    MyGroupBcInfo? GroupBcInfo = WorkInfo?.GroupBcInfo; //班组
    MyAttendances? attendances = WorkInfo?.getAttendance(); //班次

    ///fixme 第一行： 班组
    String GroupName = GroupBcInfo?.GroupName ?? ""; //班组名称，如：中空甲班
    var circle_w = px.x(40);
    var circle_color = ColorUtils.parseColor("#408BF1");
    var circle = Container(
      width: circle_w,
      height: circle_w,
      decoration: BoxDecoration(
          color: circle_color,
          borderRadius: BorderRadius.all(Radius.circular(circle_w))),
    );
    var row1 = Row(
      mainAxisAlignment: MainAxisAlignment.start,
      crossAxisAlignment: CrossAxisAlignment.center,
      children: [
        circle,
        SizedBox(
          width: px.x(20),
        ),
        Text(
          GroupName,
          style: AppStyle.textStyleWithTitle(),
        )
      ],
    );
    _columnWidgets.add(row1);

    ///fixme 第二行 班次
    String WorkTypeName = attendances?.WorkTypeName ?? ""; //班次名称，如：早班
    var bar_w = px.x(10);
    var bar_h = px.x(160);
    var bar_color = ColorUtils.parseColor("#bbbbbb");
    var bar = Container(
      alignment: Alignment.center,
      child: Container(
        width: bar_w,
        height: bar_h,
        decoration: BoxDecoration(
            color: bar_color,
            borderRadius: BorderRadius.all(Radius.circular(0))),
      ),
      width: circle_w,
      height: bar_h,
    );
    //透明条
    var bar_transparent = Container(
      alignment: Alignment.center,
      color: Colors.transparent,
      width: circle_w,
      height: bar_h,
    );
    Text row2text = Text(
      WorkTypeName,
      style: TextStyle(color: Colors.white, fontSize: 16),
    );
    Container row2Container = Container(
        child: row2text,
        alignment: Alignment.center,
        padding: EdgeInsets.only(top: 3, bottom: 3, left: 10, right: 10),
        margin: EdgeInsets.only(top: 5),
        decoration: BoxDecoration(
          color: ColorUtils.parseColor("#408BF1"),
          borderRadius: BorderRadius.all(Radius.circular(5)),
        ));
    var row2 = Row(
      mainAxisAlignment: MainAxisAlignment.start,
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        bar,
        SizedBox(
          width: px.x(20),
        ),
        row2Container
      ],
    );
    _columnWidgets.add(row2);

    ///fixme 第三行：打卡时间
    Row row3;
    var row3Text = AppStrings.of(context).punchOut; //下班打卡
    var row3Text2 = AppStrings.of(context).leaveEarly; //早退
    bool isAbnormal = WorkInfo?.isleaveEarly() ?? false; //是否异常
    String WorkTime = WorkInfo?.formatOffWorkTime() ?? ""; //打卡时间
    String adress = WorkInfo?.getOffWorkAdress() ?? ""; //打卡位置
    bool isField = WorkInfo?.isOffWorkField ?? false; //是否外勤打卡
    String imageUrl = WorkInfo?.OffWorkImageUrl ?? ""; //打卡图片
    if (WorkInfo?.isOnWork() ?? false) {
      row3Text = AppStrings.of(context).punchIn; //上班打卡
      row3Text2 = AppStrings.of(context).late; //迟到
      isAbnormal = WorkInfo?.islate() ?? false; //是否异常
      WorkTime = WorkInfo?.formatOnWorkTime() ?? ""; //打卡时间
      adress = WorkInfo?.getOnWorkAdress() ?? ""; //打卡位置
      isField = WorkInfo?.isOnWorkField ?? false; //是否外勤打卡
      imageUrl = WorkInfo?.OnWorkImageUrl ?? ""; //打卡图片
    }
    if (!isAbnormal) {
      //正常打卡
      row3 = Row(
        mainAxisAlignment: MainAxisAlignment.start,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          circle,
          SizedBox(
            width: px.x(20),
          ),
          Text(
            row3Text + " " + "$WorkTime",
            style: AppStyle.textStyleWithTitle(),
          )
        ],
      );
    } else {
      //异常打卡
      var circle_red = Container(
        width: circle_w,
        height: circle_w,
        decoration: BoxDecoration(
            color: ColorUtils.parseColor("#EF5A25"),
            borderRadius: BorderRadius.all(Radius.circular(circle_w))),
      );
      row3 = Row(
        mainAxisAlignment: MainAxisAlignment.start,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          circle_red,
          SizedBox(
            width: px.x(20),
          ),
          Text(
            row3Text + " " + "$WorkTime" + " ",
            style: AppStyle.textStyleWithTitle(),
          ),
          Text(
            row3Text2,
            style: AppStyle.textStyleWithClockInRed(),
          )
        ],
      );
    }
    _columnWidgets.add(row3);

    ///fixme 第四行：打卡位置
    Text row4text = Text(
      adress,
      style: TextStyle(
          color: ColorUtils.parseColor("#9DB0CB"), fontSize: px.x(33)),
    );
    List<Widget> row4Children = [];
    if (StringUtils.isEmpty(imageUrl)) {
      row4Children.add(bar_transparent); //fixme 位置下面没有图片显示；就搞个透明条占位。
    } else {
      row4Children.add(bar);
    }
    row4Children.add(SizedBox(
      width: px.x(20),
    ));
    row4Children.add(Container(
      child: Image.asset(
        ImagePathUtils.getPathWithImageClockin("12.png"),
        width: px.x(18),
        height: px.x(24),
      ),
      margin: EdgeInsets.only(top: px.x(35), right: 5),
    ));
    var _minWidth = px.x(100);
    if (StringUtils.isEmpty(adress)) {
      _minWidth = 0;
    }
    ConstrainedBox _constrainedBox = ConstrainedBox(
      constraints: BoxConstraints(
          minWidth: _minWidth, //最小宽度
          minHeight: px.x(50), //最小高度
          maxHeight: px.x(160), //最大高度
          maxWidth: px.x(400) //最大跨度，double.infinity 宽度尽可能大
          ),
      child: row4text,
    );
    row4Children.add(Container(
      child: _constrainedBox,
      margin: EdgeInsets.only(top: px.x(20)),
    ));
    if (isField) {
      //外勤打卡
      row4Children.add(Container(
        child: Text(
          AppStrings.of(context).fieldClock,
          style: AppStyle.textStyleWithClockInRed(),
        ),
        margin: EdgeInsets.only(top: px.x(15), left: 5),
      ));
    }
    var row4 = Row(
      mainAxisAlignment: MainAxisAlignment.start,
      crossAxisAlignment: CrossAxisAlignment.start,
      children: row4Children,
    );
    _columnWidgets.add(row4);

    ///fixme 第五行:打卡照片
    if (StringUtils.isNotEmpty(imageUrl)) {
      List<Widget> _children5 = [];
      _children5.add(circle); //fixme 小园点。
      _children5.add(SizedBox(
        width: px.x(20),
      ));
      _children5.add(Text(
        AppStrings.of(context).clockinPhotos,
        style: AppStyle.textStyleWithTitle(),
      )); //打卡照片
      var row5 = Row(
        mainAxisAlignment: MainAxisAlignment.start,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: _children5,
      );
      _columnWidgets.add(row5);
      //如果有照片
      ///fixme 第六行 照片
      //头像
      var row6 = Row(
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          InkWell(
            child: Card(
              child: Builder(
                builder: (context) {
                  // var imageUrl =
                  //     UserManager.getUserInfo()?.getPersonPictureUrl();
                  var imagePath = ImagePathUtils.getImageFail();
                  return FImage(
                    imageUrl,
                    placeholder: imagePath,
                    width: px.x(600),
                    height: px.x(600),
                    fit: BoxFit.cover,
                    isCache: true,
                    isClickable: true,
                  );
                },
              ),
              shadowColor: Colors.blue,
              //阴影颜色
              elevation: 0,
              //阴影长度
              shape: RoundedRectangleBorder(
                  side: BorderSide(
                      color: ColorUtils.parseColor("#999999"), width: 1),
                  borderRadius: BorderRadius.all(Radius.circular(px.x(20)))),
              //RoundedRectangleBorder圆角矩形边框
              clipBehavior:
                  Clip.antiAlias, // Clip.antiAlias 圆角具备切割能力;Clip.none圆角不具备切割能力。
            ),
          ),
        ],
      );
      _columnWidgets.add(Container(
        child: row6,
        margin: EdgeInsets.only(left: px.x(50)),
      ));
    }
    var column = Column(
      children: _columnWidgets,
    );
    return Container(
      child: column,
      margin: EdgeInsets.only(left: px.x(160), top: px.y(80)),
    );
  }

  ///打卡记录2（打卡记录页面里调用）
  ///isShowBar 是否显示条形竖线
  ///isOnWork true 上班打卡；false 下班打卡。
  static Widget clockInRecord2(BuildContext context, bool isShowBar,
      double _top, bool isOnWork, ClockinInfo data) {
    List<Widget> _columnWidgets = [];

    ///fixme 第一行：班次 打卡时间
    Row row1;
    var row1Text = AppStrings.of(context).punchIn; //上班打卡
    var row1Text2 = AppStrings.of(context).late; //迟到
    bool isAb = data.islate(); //是否异常;true 异常，如 迟到，或早退。
    MyAttendances? attendance = data.getAttendance(); //班次；
    String WorkTypeName = attendance?.WorkTypeName ?? ""; //班次名称
    if (StringUtils.isEmpty(WorkTypeName)) {
      if (isOnWork) {
        WorkTypeName = AppStrings.of(context).gotoWork; //上班
      } else {
        WorkTypeName = AppStrings.of(context).afterWork; //下班
      }
    }
    String WorkTime = data?.formatOnWorkTime() ?? ""; //打卡时间
    //班次开始
    String WorkTime2 =
        data?.Attendance?.formatOnWorkTime() ?? ""; //fixme 班次开始时间
    if (StringUtils.isNotEmpty(WorkTime2)) {
      WorkTime2 = AppStrings.of(context).shiftStart + " " + WorkTime2;
    }
    String Adress = data?.getOnWorkAdress() ?? ""; //打卡地址
    var hasImage = StringUtils.isNotEmpty(data?.OnWorkImageUrl); //判断是否有打卡图片
    String? imageUrl = data?.OnWorkImageUrl;
    String GroupName = data?.GroupBcInfo?.GroupName ?? ""; //班组
    if (!isOnWork) {
      row1Text = AppStrings.of(context).punchOut; //下班打卡
      row1Text2 = AppStrings.of(context).leaveEarly; //早退
      isAb = data.isleaveEarly();
      WorkTime = data?.formatOffWorkTime() ?? ""; //打卡时间
      //班次结束
      WorkTime2 = data?.Attendance?.formatOffWorkTime() ?? ""; //fixme 班次结束时间
      if (StringUtils.isNotEmpty(WorkTime2)) {
        WorkTime2 = AppStrings.of(context).shiftEnd + " " + WorkTime2;
      }
      Adress = data?.getOffWorkAdress() ?? ""; //打卡地址
      hasImage = StringUtils.isNotEmpty(data?.OffWorkImageUrl);
      imageUrl = data?.OffWorkImageUrl;
    }
    if (!isAb) {
      //正常
      Text row2text = Text(
        "$WorkTypeName",
        style: TextStyle(
            color: ColorUtils.parseColor("#333333"), fontSize: px.x(30)),
      );
      Container row2Container = Container(
          child: row2text,
          alignment: Alignment.center,
          padding: EdgeInsets.only(top: 3, bottom: 3, left: 10, right: 10),
          margin: EdgeInsets.only(top: _top),
          decoration: BoxDecoration(
            color: Colors.white,
            borderRadius: BorderRadius.all(Radius.circular(5)),
            border: Border.all(
                color: ColorUtils.parseColor("#408bf1"), width: px.x(3)),
          ));
      //正常打卡
      row1 = Row(
        mainAxisAlignment: MainAxisAlignment.start,
        crossAxisAlignment: CrossAxisAlignment.end,
        children: [
          row2Container,
          SizedBox(
            width: px.x(20),
          ),
          Text(
            row1Text + " " + "$WorkTime",
            style: AppStyle.textStyleWithTitle(),
          )
        ],
      );
    } else {
      //异常打卡
      Text row2text = Text(
        "$WorkTypeName",
        style: TextStyle(
            color: ColorUtils.parseColor("#333333"), fontSize: px.x(30)),
      );
      Container row2Container = Container(
          child: row2text,
          alignment: Alignment.center,
          padding: EdgeInsets.only(top: 3, bottom: 3, left: 10, right: 10),
          margin: EdgeInsets.only(top: _top),
          decoration: BoxDecoration(
            color: Colors.white,
            borderRadius: BorderRadius.all(Radius.circular(5)),
            border: Border.all(
                color: ColorUtils.parseColor("#ef5a25"), width: px.x(3)),
          ));
      row1 = Row(
        mainAxisAlignment: MainAxisAlignment.start,
        crossAxisAlignment: CrossAxisAlignment.end,
        children: [
          row2Container,
          SizedBox(
            width: px.x(20),
          ),
          Text(
            row1Text + " " + "$WorkTime" + " ",
            style: AppStyle.textStyleWithTitle(),
          ),
          Text(
            row1Text2,
            style: AppStyle.textStyleWithClockInRed(),
          )
        ],
      );
    }
    _columnWidgets.add(row1);

    ///fixme 第二行：打卡位置
    var circle_w = px.x(40);
    var bar_w = px.x(10);
    var bar_h = px.x(460);
    if (!hasImage) {
      bar_h = px.x(160);
    }
    var bar_color = ColorUtils.parseColor("#bbbbbb");
    if (!isShowBar) {
      bar_color = Colors.transparent;
    }
    //条形竖线
    var bar = Container(
      alignment: Alignment.center,
      margin: EdgeInsets.only(left: px.x(40), top: px.x(10), right: px.x(60)),
      child: Container(
        width: bar_w,
        height: bar_h,
        decoration: BoxDecoration(
            color: bar_color,
            borderRadius: BorderRadius.all(Radius.circular(0))),
      ),
      width: circle_w,
      height: bar_h,
    );
    //fixme 打卡地址
    Text row2text = Text(
      "$Adress",
      style: TextStyle(
          color: ColorUtils.parseColor("#9DB0CB"), fontSize: px.x(33)),
    );
    List<Widget> row2Children = [];
    row2Children.add(SizedBox(
      width: px.x(10),
    ));
    row2Children.add(Container(
      child: Image.asset(
        ImagePathUtils.getPathWithImageClockin("12.png"), //定位小图标
        width: px.x(18),
        height: px.x(24),
      ),
      margin: EdgeInsets.only(top: px.x(15), right: 5),
    ));
    var _minWidth = px.x(100);
    if (StringUtils.isEmpty(Adress)) {
      _minWidth = 0;
    }
    ConstrainedBox _constrainedBox = ConstrainedBox(
      constraints: BoxConstraints(
          minWidth: _minWidth, //最小宽度
          minHeight: px.x(50), //最小高度
          maxHeight: px.x(160), //最大高度
          maxWidth: px.x(500) //最大跨度，double.infinity 宽度尽可能大
          ),
      child: row2text,
    );
    row2Children.add(Container(
      child: _constrainedBox,
      margin: EdgeInsets.only(top: px.x(0)),
    ));
    if (isOnWork) {
      //外勤签到
      if (data.isOnWorkField) {
        //外勤打卡；
        row2Children.add(Container(
          child: Text(
            AppStrings.of(context).fieldClock,
            style: AppStyle.textStyleWithClockInRed(),
          ),
          margin: EdgeInsets.only(top: px.x(0), left: 5),
        ));
      }
    } else {
      //外勤签退
      if (data.isOffWorkField) {
        //外勤打卡；
        row2Children.add(Container(
          child: Text(
            AppStrings.of(context).fieldClock,
            style: AppStyle.textStyleWithClockInRed(),
          ),
          margin: EdgeInsets.only(top: px.x(0), left: 5),
        ));
      }
    }
    var row2 = Row(
      mainAxisAlignment: MainAxisAlignment.start,
      crossAxisAlignment: CrossAxisAlignment.start,
      children: row2Children,
    );
    List<Widget> column2s = [];
    if (StringUtils.isNotEmpty(WorkTime2)) {
      //fixme 班次开始或结束时间
      column2s.add(Text(
        " $WorkTime2",
        style: TextStyle(color: Colors.black, fontSize: px.x(33)),
      ));
    }
    column2s.add(Text(
      " $GroupName",
      style: TextStyle(color: Colors.black, fontSize: px.x(33)),
    )); //fixme 班组
    column2s.add(row2); //fixme 打卡位置
    if (hasImage) {
      ///fixme 第三行 照片
      //print("打卡图片：$imageUrl");
      //头像
      var row3 = Row(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          InkWell(
            child: Card(
              child: Builder(
                builder: (context) {
                  // var imageUrl =
                  //     UserManager.getUserInfo()?.getPersonPictureUrl();
                  var imagePath = ImagePathUtils.getImageFail();
                  return FImage(
                    imageUrl,
                    placeholder: imagePath,
                    width: px.x(300),
                    height: px.x(300),
                    fit: BoxFit.cover,
                    isCache: true,
                    isClickable: true,
                  );
                },
              ),
              shadowColor: Colors.blue,
              //阴影颜色
              elevation: 0,
              //阴影长度
              shape: RoundedRectangleBorder(
                  side: BorderSide(
                      color: ColorUtils.parseColor("#999999"), width: 1),
                  borderRadius: BorderRadius.all(Radius.circular(px.x(20)))),
              //RoundedRectangleBorder圆角矩形边框
              clipBehavior:
                  Clip.antiAlias, // Clip.antiAlias 圆角具备切割能力;Clip.none圆角不具备切割能力。
            ),
          ),
        ],
      );
      column2s.add(row3);
    }
    var column4 = Column(
      children: column2s,
      crossAxisAlignment: CrossAxisAlignment.start,
    );
    var row4 = Row(
      mainAxisAlignment: MainAxisAlignment.start,
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [bar, column4],
    );
    _columnWidgets.add(row4);
    var column = Column(
      children: _columnWidgets,
    );
    return Container(
      child: column,
      margin: EdgeInsets.only(left: px.x(100), top: px.y(8)),
    );
  }

  static DateTime? mFocusedDay = null; //当前选中的日期；
  static DateTime? onPageChangedDate = null; //当前日历页面滑动的日期。（主要判断当前滑动的月份）
  static CalendarFormat mCalendarFormat = CalendarFormat.week;

  ///日历
  static Widget tableCalendar(BuildContext context, StateSetter? parentSetState,
      ClockinPresenter? prensent) {
    if (mFocusedDay == null) {
      mFocusedDay = DateTime.now();
    }
    if (onPageChangedDate == null) {
      onPageChangedDate = mFocusedDay;
    }
    var now = DateTime.now();
    var firstDay = now.add(Duration(days: -ClokinHistoricalRecord.days));
    var lastDay = now.add(Duration(days: 2)); //结束时间比当前多两天；防止今天的时间，打明天的班次。
    return StatefulBuilder(
      builder: (context, setState) {
        TableCalendar tableCalendar = TableCalendar<String>(
          //国际化locale属性
          locale: 'zh_CN',
          //当前选中日历
          focusedDay: mFocusedDay!!,
          //DateTime.now(),
          //最小开始日期
          firstDay: firstDay,
          //设置日历最大开始日期
          lastDay: lastDay,
          //设置日历周开始时间 这里设置为周一为每周的开始时间
          startingDayOfWeek: StartingDayOfWeek.monday,
          //daysOfWeekVisible 是否显示日历周
          daysOfWeekVisible: true,
          //daysOfWeekHeight 日历周的高度，最好设置一下，不然 周一，周二等可能显示不全。
          daysOfWeekHeight: 25,
          //daysOfWeekStyle 日历周底部样式
          daysOfWeekStyle: DaysOfWeekStyle(
              //decoration 日历周底部样式，如分界线
              // decoration: BoxDecoration(
              //     border: Border(
              //         bottom: BorderSide(
              //             color: const Color.fromRGBO(213, 213, 213, 1),
              //             width: 0.4))),
              dowTextFormatter: (DateTime date, dynamic locale) {
            //返回日历周文本；默认是 周一 ，周二，周三等
            switch (date.weekday) {
              case 1:
                return "一"; //周一
              case 2:
                return "二";
              case 3:
                return "三";
              case 4:
                return "四";
              case 5:
                return "五";
              case 6:
                return "六";
              case 7:
                return "日"; //周日
            }
            return "";
          }),
          //默认上下左右均可滚动；enum AvailableGestures { none, verticalSwipe, horizontalSwipe, all }
          availableGestures: AvailableGestures.horizontalSwipe,
          onPageChanged: (value) {
            //滑动页面，返回类型为 DateTime
            //返回当前页面显示月份的1号；如：2022-04-01 00:00:00.000Z
            //如果滑动页面是今天的月份；就返回今天的日期。如：2022-03-24 00:00:00.000Z
            parentSetState?.call(() {
              mFocusedDay = value;
              onPageChangedDate = value;
            });
          },
          onDayLongPressed: (selectedDay, focusedDay) {
            //日期长按；selectedDay和focusedDay都是一样的，返回的都是当前选中日期。
            parentSetState?.call(() {
              mFocusedDay = selectedDay;
              onPageChangedDate = focusedDay;
            });
          },
          onDaySelected: (selectedDay, focusedDay) {
            //日期单击；selectedDay和focusedDay都是一样的，返回的都是当前选中日期。
            parentSetState?.call(() {
              mFocusedDay = selectedDay;
              onPageChangedDate = focusedDay;
            });
          },
          //selectedDayPredicate 判断是否为选中的日期；必须要有，不然选中样式无效。因为他不知道是否为选中日期。
          selectedDayPredicate: (day) =>
              //isSameDay 判断是否为相同的一天；系统自带判断方法。
              isSameDay(mFocusedDay, day),
          headerVisible: true,
          //设日历头部显示和隐藏
          headerStyle: HeaderStyle(
            titleTextStyle: TextStyle(fontSize: 25),
            //titleCentered 文本居中
            titleCentered: true,
            //titleTextFormatter 自定义标题文本；默认是年月，如：2022年2月
            // titleTextFormatter: (DateTime date, dynamic locale) {
            //   return date.toString();
            // },
            //leftChevronVisible 左边箭头
            leftChevronVisible: true,
            rightChevronVisible: true,
            //formatButtonVisible 是否显示日历模式切换按钮；（每月，两周，一周）;fixme 日期模式切换，并且会跳转到当前选中的日期。
            formatButtonVisible: false,
            formatButtonTextStyle: TextStyle(fontSize: 15),
            //formatButtonShowsNext true 显示下一个模式；false 显示当前日历模式
            formatButtonShowsNext: false,
          ),
          //calendarFormat 日历格式（每月，两周，一周） CalendarFormat.month;CalendarFormat.twoWeeks;CalendarFormat.week;
          calendarFormat: mCalendarFormat,
          //onFormatChanged 用于实现日历的上下滑动的伸缩效果
          onFormatChanged: (format) {
            if (mCalendarFormat != format) {
              setState(() {
                mCalendarFormat = format;
              });
            }
          },
          //设置选中状态和非选中状态颜色等参数
          calendarStyle: CalendarStyle(
              holidayTextStyle: TextStyle(color: Colors.red),
              holidayDecoration: BoxDecoration(
                  color: Colors.transparent, shape: BoxShape.circle),
              //fixme outsideDaysVisible 非当月日期是否需要显示出来;true 显示；false 只显示当前月份的日期。
              outsideDaysVisible: false,
              // outsideDecoration: BoxDecoration(
              //   color: Colors.cyan,
              // ),
              markersMaxCount: 1,
              // outsideDecoration: ,
              // markerSize: 10,
              // markersAlignment: Alignment.bottomCenter,
              // markerMargin: EdgeInsets.only(top: 8),
              // cellMargin: EdgeInsets.symmetric(horizontal: 10, vertical: 10),
              //fixme todayDecoration  当前日期，即今天日期的样式。
              todayDecoration: BoxDecoration(
                color: ColorUtils.parseColor("#552196F3"),
                shape: BoxShape.circle,
              ),
              //fixme selectedDecoration 选中日期样式
              selectedDecoration:
                  BoxDecoration(shape: BoxShape.circle, color: Colors.blue),
              // markerSizeScale: 5,
              markerDecoration:
                  BoxDecoration(color: Colors.cyan, shape: BoxShape.circle),
              canMarkersOverflow: true),
          calendarBuilders: CalendarBuilders(markerBuilder:
              (BuildContext context, DateTime day, List<String> events) {
            BoxDecoration decoration;
            //fixme 日期地下的小圆点；一般用于特色事件标注，如迟到等。
            var datas = prensent?.getDatasWithDateTimeDays(day);
            if (datas != null && datas.length > 0) {
              bool isRed = false; //true 红色；false 蓝色（正常上班）
              datas?.forEach((element) {
                if (element.islate() || element.isleaveEarly()) {
                  isRed = true;
                }
              });
              if (isRed) {
                decoration = const BoxDecoration(
                    shape: BoxShape.circle, color: Colors.red); //fixme 打卡异常
                return Container(
                    width: 7,
                    height: 7,
                    margin: EdgeInsets.only(bottom: px.x(28)),
                    decoration: decoration);
              } else {
                decoration = const BoxDecoration(
                    shape: BoxShape.circle, color: Colors.blue); //fixme 正常打卡
                return Container(
                    width: 7,
                    height: 7,
                    margin: EdgeInsets.only(bottom: px.x(28)),
                    decoration: decoration);
              }
            }
            return null;
          }),
        );
        Divider leftDivider = Divider(
          height: 1,
          //Divider 组件的高度
          thickness: 1,
          //分割线的高度
          indent: 12,
          //左边间距
          endIndent: 0,
          //右边间距
          color: ColorUtils.parseColor("#cccccc"), //分割线颜色。
        );
        Divider rightDivider = Divider(
          height: 1,
          //Divider 组件的高度
          thickness: 1,
          //分割线的高度
          indent: 0,
          //左边间距
          endIndent: 12,
          //右边间距
          color: ColorUtils.parseColor("#cccccc"), //分割线颜色。
        );
        Widget icon;
        if (mCalendarFormat == CalendarFormat.month) {
          icon = Icon(
            IconsUtils.arrow_up_619,
            color: ColorUtils.parseColor("#cccccc"),
            size: 25,
          );
        } else {
          icon = Icon(
            IconsUtils.arrow_down_61a,
            color: ColorUtils.parseColor("#cccccc"),
            size: 25,
          );
        }
        Row row = Row(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Expanded(child: leftDivider),
            InkWell(
              child: Container(
                child: icon,
                alignment: Alignment.center,
                width: 40,
                margin: EdgeInsets.only(top: 6, bottom: 6),
              ),
              onTap: () {
                setState(() {
                  if (mCalendarFormat == CalendarFormat.month) {
                    mCalendarFormat = CalendarFormat.week;
                  } else {
                    mCalendarFormat = CalendarFormat.month;
                  }
                });
              },
            ),
            Expanded(child: rightDivider)
          ],
        );
        Column column = Column(
          children: [tableCalendar, row],
        );
        return column;
      },
    );
  }

  ///强制性工单（标题）
  static Widget tableGondanTitle(BuildContext context, ClokinPointRange? data,
      WageSettlement? wageSettlement, bool is102) {
    // if(ClockinResultRoute.isOffWork){
    //   //下班签到
    //   return AppUi.getEmptyView();
    // }
    WageSettlement? wage = wageSettlement; //fixme 工资
    // if (StringUtils.isEmpty(data?.WorkInfo?.OffWorkTime) || wage == null) {
    //   return AppUi.getEmptyView(); //fixme 下班时间为空；肯定没有结算工资
    // }
    //String settlenment = "强制性工单信息";
    String settlenment=AppStrings.of(context).Ticketreminder;//工单提醒
    // String settlenment = "工单提醒";
    if (is102) {
      //当日结算。
    } else {
      //本次结算。
    }
    // String? GroupName =
    //     (data?.WorkInfo?.GroupBcInfo?.GroupName ?? "") + settlenment;
    String? GroupName = settlenment;
    return Center(
      child: Text(
        GroupName ?? "",
        style: TextStyle(
          color: Colors.black,
          fontWeight: FontWeight.bold,
          fontSize: 20,
        ),
      ),
    );
  }

  ///强制性工单列表
  static Widget tableGondan(BuildContext context, ClokinPointRange? data,
      WageSettlement? wageSettlement, bool is102) {
    WageSettlement? wage = wageSettlement; //fixme 工资
    // if (StringUtils.isEmpty(data?.WorkInfo?.OffWorkTime) || wage == null) {
    //   return AppUi.getEmptyView(); //fixme 下班时间为空；肯定没有结算工资
    // }
    String dayproduction;
    // if (is102) {
    //   dayproduction = AppStrings.of(context).dayproduction; //当日产量(片)
    // } else {
    //   dayproduction = AppStrings.of(context).Theproduction; //本次产量(片)
    // }
    WageProduction? wageProduction = wage?.wageProduction;
    var tableRow = <TableRow>[];
    //标题
    tableRow.add(TableRow(
        //第一行，添加背景色
        decoration: BoxDecoration(color: ColorUtils.parseColor("#94C898")),
        children: [
          TableCell(
              child: Center(
            child: Text(AppStrings.of(context).TheSerial), //序号
          )),
          // TableCell(
          //     child: Center(
          //   child: Text(AppStrings.of(context).TicketNo), //工单号 1
          // )),
          // TableCell(
          //     child: Center(
          //   child: Text(AppStrings.of(context).Lv), //等级 2
          // )),
          TableCell(
              child: Center(
            child: Text(AppStrings.of(context).DName1), //一级设备名称 3
          )),
          TableCell(
              child: Center(
            child: Text(AppStrings.of(context).DName2), //二级设备名称 4
          )),
          TableCell(
              child: Center(
            child: Text(AppStrings.of(context).DName3), //三级设备名称 5
          )),
          // TableCell(
          //     child: Center(
          //   child: Text(AppStrings.of(context).Workordertype), //工单类型 6
          // )),
          // TableCell(
          //     child: Center(
          //   child: Text(AppStrings.of(context).Repairtime), //报修时间 7
          // )),
          // TableCell(
          //     child: Center(
          //   child: Text(AppStrings.of(context).repairman), //报修人员 8
          // )),
          // TableCell(
          //     child: Center(
          //   child: Text(AppStrings.of(context).process), //工序 9
          // )),
        ]));
    //内容
    for (int i = 1; i <= 2; i++) {
      tableRow.add(TableRow(
          decoration: BoxDecoration(color: ColorUtils.parseColor("#E0EEEE")),
          children: [
            TableCell(
                child: Center(
              child: Text("${i}"), //序号
            )),
            // TableCell(
            //     child: Center(
            //   child: Text("${"ER240524012"}"), //工单号
            // )),
            // TableCell(
            //     child: Center(
            //   child: Text("${"紧急"}"), //等级
            // )),
            TableCell(
                child: Center(
              child: Text("中空生产线"), //一级设备名称
            )),
            TableCell(
                child: Center(
              child: Text("下片台"), //二级设备名称 4
            )),
            TableCell(
                child: Center(
              child: Text(
                "水泵",
                // style: TextStyle(color: Colors.green)
              ), //三级设备名称 5
            )),
            // TableCell(
            //     child: Center(
            //   child: Text("强制性工单"), //工单类型 6
            // )),
            // TableCell(
            //     child: Center(
            //   child: Text("2024-05-24 10:14:18"), //报修时间 7
            // )),
            // TableCell(
            //     child: Center(
            //   child: Text("张三,李四,王二娃"), //报修人员 8
            // )),
            // TableCell(
            //     child: Center(
            //   child: Text("中空"), //工序 9
            // )),
          ]));
    }
    var table = Table(
      //border 表格边框样式
      border: TableBorder.symmetric(
          //fixme 这里的边框 width:0 设置为0，也是有边框的。除非不设置，如：outside: BorderSide.none
          inside: BorderSide(color: Colors.black, width: 1),
          outside: BorderSide(color: Colors.black, width: 1)),
      //TableCellVerticalAlignment.middle 居中;
      defaultVerticalAlignment: TableCellVerticalAlignment.middle,
      //fixme 只能控制垂直居中，水平居中，请在单元格里使用Center()组件。
      //textDirection 列的排序方式；TextDirection.ltr 从左往右排；TextDirection.rtl 从右往左排。
      textDirection: TextDirection.ltr,
      columnWidths: {
        0: FlexColumnWidth(0.5), //FlexColumnWidth 宽度占比；默认各个单元格占比都是1:1
        // 7: FlexColumnWidth(2)
      },
      children: tableRow,
    );
    Widget defalutText = DefaultTextStyle(
      //fixme 1.设置文本默认样式
      style: TextStyle(
        color: Colors.black,
        fontSize: 20.0,
      ),
      textAlign: TextAlign.start,
      child: table,
    );
    return SingleChildScrollView(
      scrollDirection: Axis.horizontal,
      physics: BouncingScrollPhysics(),
      child: Container(
        width: px.screenWidth() * 1.5,
        child: defalutText,
        margin: EdgeInsets.only(bottom: 10),
      ),
    );
  }

  ///结算工资（标题）
  static Widget tableWageTitle(BuildContext context, ClokinPointRange? data,
      WageSettlement? wageSettlement, bool is102) {
    WageSettlement? wage = wageSettlement; //fixme 工资
    if (StringUtils.isEmpty(data?.WorkInfo?.OffWorkTime) || wage == null) {
      return AppUi.getEmptyView(); //fixme 下班时间为空；肯定没有结算工资
    }
    String settlenment;
    if (is102) {
      settlenment = AppStrings.of(context).daysettlement; //当日结算。
    } else {
      settlenment = AppStrings.of(context).Thesettlement; //本次结算。
    }
    String? GroupName =
        (data?.WorkInfo?.GroupBcInfo?.GroupName ?? "") + settlenment;
    return Center(
      child: Text(
        GroupName ?? "",
        style: TextStyle(
          color: Colors.black,
          fontWeight: FontWeight.bold,
          fontSize: 20,
        ),
      ),
    );
  }

  ///结算工资（当日产量）
  static Widget tableWageProduction(BuildContext context,
      ClokinPointRange? data, WageSettlement? wageSettlement, bool is102) {
    WageSettlement? wage = wageSettlement; //fixme 工资
    if (StringUtils.isEmpty(data?.WorkInfo?.OffWorkTime) || wage == null) {
      return AppUi.getEmptyView(); //fixme 下班时间为空；肯定没有结算工资
    }
    String dayproduction;
    if (is102) {
      dayproduction = AppStrings.of(context).dayproduction; //当日产量(片)
    } else {
      dayproduction = AppStrings.of(context).Theproduction; //本次产量(片)
    }
    WageProduction? wageProduction = wage?.wageProduction;
    var tableRow = <TableRow>[];
    //标题
    tableRow.add(TableRow(
        //第一行，添加背景色
        decoration: BoxDecoration(color: ColorUtils.parseColor("#94C898")),
        children: [
          TableCell(
              child: Center(
            child: Text(dayproduction), //当日产量(片)
          )),
          TableCell(
              child: Center(
            child: Text(AppStrings.of(context).DAreasquare), //面积(平米)
          )),
          TableCell(
              child: Center(
            child: Text(AppStrings.of(context).Circumferencem), //周长(米)
          )),
          TableCell(
              child: Center(
            child: Text(AppStrings.of(context).Weightkg), //重量(千克)
          )),
          TableCell(
              child: Center(
            child: Text(AppStrings.of(context).AmountYuan), //金额(元)
          )),
        ]));
    //内容
    for (int i = 1; i <= 1; i++) {
      tableRow.add(TableRow(
          decoration: BoxDecoration(color: ColorUtils.parseColor("#E0EEEE")),
          children: [
            TableCell(
                child: Center(
              child: Text("${wageProduction?.ProductionNum ?? ""}"), //当日产量(片)
            )),
            TableCell(
                child: Center(
              child: Text("${wageProduction?.Area ?? ""}"), //面积(平米)
            )),
            TableCell(
                child: Center(
              child: Text("${wageProduction?.Perimeter ?? ""}"), //周长(米)
            )),
            TableCell(
                child: Center(
              child: Text("${wageProduction?.Weight ?? ""}"), //重量(千克)
            )),
            TableCell(
                child: Center(
              child: Text("${wageProduction?.Amount ?? ""}",
                  style: TextStyle(color: Colors.green)), //金额(元)
            )),
          ]));
    }
    var table = Table(
      //border 表格边框样式
      border: TableBorder.symmetric(
          //fixme 这里的边框 width:0 设置为0，也是有边框的。除非不设置，如：outside: BorderSide.none
          inside: BorderSide(color: Colors.black, width: 1),
          outside: BorderSide(color: Colors.black, width: 1)),
      //TableCellVerticalAlignment.middle 居中;
      defaultVerticalAlignment: TableCellVerticalAlignment.middle,
      //fixme 只能控制垂直居中，水平居中，请在单元格里使用Center()组件。
      //textDirection 列的排序方式；TextDirection.ltr 从左往右排；TextDirection.rtl 从右往左排。
      textDirection: TextDirection.ltr,
      columnWidths: {
        0: FlexColumnWidth(1) //FlexColumnWidth 宽度占比；默认各个单元格占比都是1:1
      },
      children: tableRow,
    );
    Widget defalutText = DefaultTextStyle(
      //fixme 1.设置文本默认样式
      style: TextStyle(
        color: Colors.black,
        fontSize: 20.0,
      ),
      textAlign: TextAlign.start,
      child: table,
    );
    return SingleChildScrollView(
      scrollDirection: Axis.horizontal,
      physics: BouncingScrollPhysics(),
      child: Container(
        width: px.screenWidth() * 2,
        child: defalutText,
        margin: EdgeInsets.only(bottom: 10),
      ),
    );
  }

  ///结算工资（当日补片）
  static Widget tableWagePatch(BuildContext context, ClokinPointRange? data,
      WageSettlement? wageSettlement, bool is102) {
    WageSettlement? wage = wageSettlement; //fixme 工资
    if (StringUtils.isEmpty(data?.WorkInfo?.OffWorkTime) || wage == null) {
      return AppUi.getEmptyView(); //fixme 下班时间为空；肯定没有结算工资
    }
    String Samedaypatch;
    if (is102) {
      Samedaypatch = AppStrings.of(context).Samedaypatch; //当日补片(片)
    } else {
      Samedaypatch = AppStrings.of(context).Thispatch; //本次补片(片)
    }
    WagePatch? wagePatch = wage?.wagePatch;
    var tableRow = <TableRow>[];
    //标题
    tableRow.add(TableRow(
        //第一行，添加背景色
        decoration: BoxDecoration(color: ColorUtils.parseColor("#94C898")),
        children: [
          TableCell(
              child: Center(
            child: Text(Samedaypatch), //当日补片(片)
          )),
          TableCell(
              child: Center(
            child: Text(AppStrings.of(context).DAreasquare), //面积(平米)
          )),
          TableCell(
              child: Center(
            child: Text(AppStrings.of(context).AmountYuan), //金额(元)
          )),
        ]));
    //内容
    for (int i = 1; i <= 1; i++) {
      tableRow.add(TableRow(
          decoration: BoxDecoration(color: ColorUtils.parseColor("#E0EEEE")),
          children: [
            TableCell(
                child: Center(
              child: Text("${wagePatch?.PatchNum ?? ""}"), //当日补片(片)
            )),
            TableCell(
                child: Center(
              child: Text("${wagePatch?.Area ?? ""}"), //面积(平米)
            )),
            TableCell(
                child: Center(
              child: Text("${wagePatch?.Amount ?? ""}",
                  style: TextStyle(color: Colors.red)), //金额(元)
            )),
          ]));
    }
    var table = Table(
      //border 表格边框样式
      border: TableBorder.symmetric(
          //fixme 这里的边框 width:0 设置为0，也是有边框的。除非不设置，如：outside: BorderSide.none
          inside: BorderSide(color: Colors.black, width: 1),
          outside: BorderSide(color: Colors.black, width: 1)),
      //TableCellVerticalAlignment.middle 居中;
      defaultVerticalAlignment: TableCellVerticalAlignment.middle,
      //fixme 只能控制垂直居中，水平居中，请在单元格里使用Center()组件。
      //textDirection 列的排序方式；TextDirection.ltr 从左往右排；TextDirection.rtl 从右往左排。
      textDirection: TextDirection.ltr,
      columnWidths: {
        0: FlexColumnWidth(1) //FlexColumnWidth 宽度占比；默认各个单元格占比都是1:1
      },
      children: tableRow,
    );
    Widget defalutText = DefaultTextStyle(
      //fixme 1.设置文本默认样式
      style: TextStyle(
        color: Colors.black,
        fontSize: 20.0,
      ),
      textAlign: TextAlign.start,
      child: table,
    );
    return SingleChildScrollView(
      scrollDirection: Axis.horizontal,
      physics: BouncingScrollPhysics(),
      child: Container(
        width: px.screenWidth() * 1,
        child: defalutText,
        margin: EdgeInsets.only(bottom: 10),
      ),
    );
  }

  ///结算工资（班次）
  static Widget tableWageShift(BuildContext context, ClokinPointRange? data,
      WageSettlement? wageSettlement, bool is102) {
    WageSettlement? wage = wageSettlement; //fixme 工资
    List<WageShift>? wageShifts = wage?.wageShift;
    if (StringUtils.isEmpty(data?.WorkInfo?.OffWorkTime) ||
        wage == null ||
        wageShifts == null) {
      return AppUi.getEmptyView(); //fixme 下班时间为空；肯定没有结算工资
    }
    MyAttendances? attendance = data?.WorkInfo?.getAttendance(); //班次
    var tableRow = <TableRow>[];
    //标题
    tableRow.add(TableRow(
        //第一行，添加背景色
        decoration: BoxDecoration(color: ColorUtils.parseColor("#94C898")),
        children: [
          TableCell(
              child: Center(
            child: Text(AppStrings.of(context).shift), //班次
          )),
          TableCell(
              child: Center(
            child: Text(AppStrings.of(context).piecesrequired), //应领用片数（片）
          )),
          TableCell(
              child: Center(
            child: Text(AppStrings.of(context).originalpieces), //实际使用原片数（片）
          )),
          TableCell(
              child: Center(
            child: Text(
                AppStrings.of(context).originalfilmsusedmultiple), //多领用原片数（片）
          )),
          TableCell(
              child: Center(
            child: Text(
                AppStrings.of(context).Multioriginalfilmarea), //多领用原片面积（平米）
          )),
        ]));
    //内容
    for (int i = 0; i < wageShifts!.length; i++) {
      var wageShift = wageShifts[i];
      tableRow.add(TableRow(
          decoration: BoxDecoration(color: ColorUtils.parseColor("#E0EEEE")),
          children: [
            TableCell(
                child: Center(
              child: Text(
                  "${wageShift?.WorkTypeName}: ${wageShift?.OnWorkTime}-${wageShift?.OffWorkTime}"), //班次
            )),
            TableCell(
                child: Center(
              child: Text("${wageShift?.Piecesrequired ?? ""}"), //应领用片数（片）
            )),
            TableCell(
                child: Center(
              child: Text("${wageShift?.Originalpieces ?? ""}"), //实际使用原片数（片）
            )),
            TableCell(
                child: Center(
              child: Text("${wageShift?.Originalfilmsusedmultiple ?? ""}",
                  style: TextStyle(color: Colors.red)), //多领用原片数（片）
            )),
            TableCell(
                child: Center(
              child: Text("${wageShift?.Multioriginalfilmarea ?? ""}",
                  style: TextStyle(color: Colors.red)), //多领用原片面积（平米）
            )),
          ]));
    }
    var table = Table(
      //border 表格边框样式
      border: TableBorder.symmetric(
          //fixme 这里的边框 width:0 设置为0，也是有边框的。除非不设置，如：outside: BorderSide.none
          inside: BorderSide(color: Colors.black, width: 1),
          outside: BorderSide(color: Colors.black, width: 1)),
      //TableCellVerticalAlignment.middle 居中;
      defaultVerticalAlignment: TableCellVerticalAlignment.middle,
      //fixme 只能控制垂直居中，水平居中，请在单元格里使用Center()组件。
      //textDirection 列的排序方式；TextDirection.ltr 从左往右排；TextDirection.rtl 从右往左排。
      textDirection: TextDirection.ltr,
      columnWidths: {
        0: FlexColumnWidth(1) //FlexColumnWidth 宽度占比；默认各个单元格占比都是1:1
      },
      children: tableRow,
    );
    Widget defalutText = DefaultTextStyle(
      //fixme 1.设置文本默认样式
      style: TextStyle(
        color: Colors.black,
        fontSize: 20.0,
      ),
      textAlign: TextAlign.start,
      child: table,
    );
    return SingleChildScrollView(
      scrollDirection: Axis.horizontal,
      physics: BouncingScrollPhysics(),
      child: Container(
        width: px.screenWidth() * 3,
        child: defalutText,
        margin: EdgeInsets.only(bottom: 10),
      ),
    );
  }

  ///结算工资
  static Widget tableWage(BuildContext context, ClokinPointRange? data,
      WageSettlement? wageSettlemen, bool is102) {
    WageSettlement? wageSettlement = wageSettlemen; //fixme 工资
    List<WagePerson>? wagePersons = wageSettlement?.wagePersons;
    if (StringUtils.isEmpty(data?.WorkInfo?.OffWorkTime) ||
        wagePersons == null) {
      return AppUi.getEmptyView(); //fixme 下班时间为空；肯定没有结算工资
    }
    var tableRow = <TableRow>[];
    if (is102) {
      //当日工资
      //标题
      tableRow.add(TableRow(
          //第一行，添加背景色
          decoration: BoxDecoration(color: ColorUtils.parseColor("#94C898")),
          children: [
            TableCell(
                child: Center(
              child: Text(AppStrings.of(context).TheSerial), //序号
            )),
            TableCell(
                child: Center(
              child: Text(AppStrings.of(context).StaffName), //员工名称
            )),
            TableCell(
                child: Center(
              child: Text(AppStrings.of(context).takeamount), //'实得金额'
            )),
            TableCell(
                child: Center(
              child: Text(AppStrings.of(context).compensationpayable), //'赔偿金额'
            )),
            TableCell(
                child: Center(
              child: Text(AppStrings.of(context).Delaypenalty), //'推迟罚金'
            )),
            TableCell(
                child: Center(
              child: Text(AppStrings.of(context).Amountoftime), //'计时金额'
            )),
            TableCell(
                child: Center(
              child: Text(AppStrings.of(context).Transferthesubsidies), //'调动补贴'
            )),
            TableCell(
                child: Center(
              child: Text(AppStrings.of(context).Pieceworkamount), //'计件金额'
            )),
            TableCell(
                child: Center(
              child: Text(AppStrings.of(context).Qualityawardamount), //'质量奖金额'
            )),
            TableCell(
                child: Center(
              child: Text(AppStrings.of(context).processingrefund), //'审核退款'
            )),
            TableCell(
                child: Center(
              child: Text(AppStrings.of(context).Energyconsumption), //'能耗奖赔'
            )),
            TableCell(
                child: Center(
              child: Text(AppStrings.of(context).Otherpunishment), //'其他奖罚'
            )),
          ]));
      //内容
      for (int i = 0; i < wagePersons.length; i++) {
        WagePerson wage = wagePersons[i];
        tableRow.add(TableRow(
            decoration: BoxDecoration(color: ColorUtils.parseColor("#E0EEEE")),
            children: [
              TableCell(
                  child: Center(
                child: Text("${(i + 1).toString()}"), //序号
              )),
              TableCell(
                  child: Center(
                child: Text('${wage?.PersonName}'), //员工名称
              )),
              TableCell(
                  child: Center(
                child: Text('${wage?.Takeamount}',
                    style: TextStyle(color: Colors.green)), //实得金额
              )),
              TableCell(
                  child: Center(
                child: Text('${wage?.Compensationpayable}',
                    style: TextStyle(color: Colors.red)), //赔偿金额
              )),
              TableCell(
                  child: Center(
                child: Text('${wage?.Delaypenalty}',
                    style: TextStyle(color: Colors.red)), //推迟罚金
              )),
              TableCell(
                  child: Center(
                child: Text('${wage?.Amountoftime}'), //计时金额
              )),
              TableCell(
                  child: Center(
                child: Text('${wage?.Transferthesubsidies}'), //调动补贴
              )),
              TableCell(
                  child: Center(
                child: Text('${wage?.Pieceworkamount}'), //计件金额
              )),
              TableCell(
                  child: Center(
                child: Text('${wage?.Qualityawardamount}'), //质量奖金额
              )),
              TableCell(
                  child: Center(
                child: Text('${wage?.Processingrefund}'), //审核退款
              )),
              TableCell(
                  child: Center(
                child: Text('${wage?.Energyconsumption}'), //能耗奖赔
              )),
              TableCell(
                  child: Center(
                child: Text('${wage?.Otherpunishment}'), //其他奖罚
              )),
            ]));
      }
    } else {
      //本次工资
      //标题
      tableRow.add(TableRow(
          //第一行，添加背景色
          decoration: BoxDecoration(color: ColorUtils.parseColor("#94C898")),
          children: [
            TableCell(
                child: Center(
              child: Text(AppStrings.of(context).TheSerial), //序号
            )),
            TableCell(
                child: Center(
              child: Text(AppStrings.of(context).StaffName), //员工名称
            )),
            TableCell(
                child: Center(
              child: Text(AppStrings.of(context).takeamount2), //'实得工资'
            )),
            TableCell(
                child: Center(
              child: Text(AppStrings.of(context).compensationpayable), //'赔偿金额'
            )),
            TableCell(
                child: Center(
              child: Text(AppStrings.of(context).Pieceworkamount2), //'计件工资'
            )),
            TableCell(
                child: Center(
              child: Text(AppStrings.of(context).Qualityawardamount2), //'质量奖金'
            )),
            TableCell(
                child: Center(
              child: Text(AppStrings.of(context).Energyconsumption), //'能耗奖赔'
            )),
          ]));
      //内容
      for (int i = 0; i < wagePersons.length; i++) {
        WagePerson wage = wagePersons[i];
        tableRow.add(TableRow(
            decoration: BoxDecoration(color: ColorUtils.parseColor("#E0EEEE")),
            children: [
              TableCell(
                  child: Center(
                child: Text("${(i + 1).toString()}"), //序号
              )),
              TableCell(
                  child: Center(
                child: Text('${wage?.PersonName}'), //员工名称
              )),
              TableCell(
                  child: Center(
                child: Text('${wage?.Takeamount}',
                    style: TextStyle(color: Colors.green)), //实得工资
              )),
              TableCell(
                  child: Center(
                child: Text('${wage?.Compensationpayable}',
                    style: TextStyle(color: Colors.red)), //赔偿金额
              )),
              TableCell(
                  child: Center(
                child: Text('${wage?.Pieceworkamount}'), //计件工资
              )),
              TableCell(
                  child: Center(
                child: Text('${wage?.Qualityawardamount}'), //质量奖金
              )),
              TableCell(
                  child: Center(
                child: Text('${wage?.Energyconsumption}'), //能耗奖赔
              )),
            ]));
      }
    }

    var table = Table(
      //border 表格边框样式
      border: TableBorder.symmetric(
          //fixme 这里的边框 width:0 设置为0，也是有边框的。除非不设置，如：outside: BorderSide.none
          inside: BorderSide(color: Colors.black, width: 1),
          outside: BorderSide(color: Colors.black, width: 1)),
      //TableCellVerticalAlignment.middle 居中;
      defaultVerticalAlignment: TableCellVerticalAlignment.middle,
      //fixme 只能控制垂直居中，水平居中，请在单元格里使用Center()组件。
      //textDirection 列的排序方式；TextDirection.ltr 从左往右排；TextDirection.rtl 从右往左排。
      textDirection: TextDirection.ltr,
      columnWidths: {
        0: FlexColumnWidth(0.5) //FlexColumnWidth 宽度占比；默认各个单元格占比都是1:1
      },
      children: tableRow,
    );
    Widget defalutText = DefaultTextStyle(
      //fixme 1.设置文本默认样式
      style: TextStyle(
        color: Colors.black,
        fontSize: 20.0,
      ),
      textAlign: TextAlign.start,
      child: table,
    );
    return SingleChildScrollView(
      scrollDirection: Axis.horizontal,
      physics: BouncingScrollPhysics(),
      child: Container(
        width: px.screenWidth() * 3.5,
        child: defalutText,
      ),
    );
  }
}
